fileOut = open("bitshift.html", "w")

number = (2**40)-1
shiftTimes = 1
j = 0
i = 1
list = []

fileOut.write('<html><head><title>No. ' + '%s' % (number) + ': Color Test page</title></head>\n<body bgcolor="FFFFFF" text="000000" links="00FF00">\n<center><h1>No. ' + '%s' % (number) + ': Color Test page</h1></center>\n<p>\n<br>')

list.append(number)

#print i, number
# hexColor = '<font color="BLACK">'+'%04i'%(i) + ':    </font><font size="3" color="'+'%06X' % (number) + '">'+'%06X' % (number)+'-->#</font><br>\n'
# fileOut.write(hexColor)
hexColor = '<font size="1" color="'+'%06X' % (number) + '">###</font><BR>\n'
fileOut.write(hexColor)
while number != 0:
	j = 0
	while j < shiftTimes and number != 0:
		number = number >> 1
		i += 1
		j += 1
		# print i, number
		# hexColor = '<font color="BLACK">'+'%04i'%(i) + ':    </font><font size="3" color="'+'%06X' % (number) + '">'+'%06X' % (number)+'-->#</font><br>\n'
		# fileOut.write(hexColor)
		hexColor = '<font size="1" color="'+'%06X' % (number) + '">###</font>\n'
		fileOut.write(hexColor)
		list.append(number)
	j = 0
	while j < shiftTimes and number != 0:
		number = number << 1
		i += 1
		j += 1
		#print i, number
		# hexColor = '<font color="BLACK">'+'%04i'%(i) + ':    </font><font size="3" color="'+'%06X' % (number) + '">'+'%06X' % (number)+'-->#</font><br>\n'
		# fileOut.write(hexColor)
		hexColor = '<font size="1" color="'+'%06X' % (number) + '">###</font>\n'
		fileOut.write(hexColor)
		list.append(number)
	shiftTimes += 1
	hexColor = '<br>\n'
	fileOut.write(hexColor)

#print "list: ", list

# for r in list:
	# for g in list:
		# for b in list:
			# hexColor = '<font size="3" color="'+'%02X%02X%02X' % (r,g,b) + '">'+'%02X%02X%02X' % (r,g,b)+'</font><br>\n'
			#fileOut.write(hexColor)
			

fileOut.write("<P>\n</html>\n</body>")
fileOut.close()